<?php $this->fetch('public/head') ?>
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this"><a href="<?php echo url('index') ?>">申请列表</a></li>
        </ul>
        <div class="layui-tab-content">
            <form class="layui-form layui-form-pane" action="<?php echo url('index') ?>" method="get">
                <div class="layui-inline">
                    <label class="layui-form-label">姓名查找</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" value="<?php echo input('name') ?>" placeholder="请输入关键词" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">区域查找</label>
                    <div class="layui-input-inline">
                        <input type="text" name="city" value="<?php echo input('city') ?>" placeholder="请输入区域" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">确认人查找</label>
                    <div class="layui-input-inline">
                        <input type="text" name="offer" value="<?php echo input('offer') ?>" placeholder="请输入确认人" class="layui-input">
                    </div>
                </div>


                        <div class="layui-inline">
                            <label class="layui-form-label">开始日期</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="begin" name="begin" value="<?php echo input('begin') ?>" placeholder="yyyy-MM-dd">
                            </div>
                        </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束日期</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" id="end" name="end" value="<?php echo input('end') ?>" placeholder="yyyy-MM-dd">
                    </div>
                </div>


                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
            </form>
            <div class="layui-inline">
                <button class="layui-btn outputthis" href="<?php echo url('output',
                    ['name'=>input('name'),
                    'city'=>input('city'),
                        'offer'=>input('offer'),
                        'begin'=>input('begin'),
                        'end'=>input('end')]) ?>">导出当前条件记录</button>
            </div>
            <div class="layui-inline">
                <button class="layui-btn outputall" href="<?php echo url('output') ?>">导出全部记录</button>
            </div>
            <hr>

            <form action="" method="post" class="ajax-form">
                <div class="layui-tab-item layui-show">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th style="width: 30px;">ID</th>
                            <th>申请人姓名</th>
                            <th>申请人电话</th>
                            <th>申请方案名称</th>
                            <th>意向车型</th>
                            <th>区域</th>
                            <th>状态</th>
                            <th>申请时间</th>
                            <th>处理人</th>
                            <th>处理时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach($list as $v): ?>
                            <tr>
                                <td><?php echo $v['id'] ?></td>
                                <td><?php echo $v['username']?></td>
                                <td><?php echo $v['phone']?></td>
                                <td><?php echo $v['name']?></td>
                                <td><?php echo $v['yixiang']?></td>
                                <td><?php echo $v['city']?></td>
                                <td>
                                    <?php if($v['status']==1): ?>
                                        <a class="layui-btn layui-btn-xs ajax-post">已处理</a>
                                    <?php else: ?>
                                        <a class="layui-btn layui-btn-danger layui-btn-xs ajax-post">未处理</a>
                                    <?php endif; ?>
                                </td>
                                <td><?php echo $v['addtime']?></td>
                                <td><?php echo $v['offer']?></td>
                                <td><?php echo $v['offertime']?></td>
                                <td>
                                    <a href="<?php echo url('detail?id='.$v['id']) ?>" class="layui-btn layui-btn-normal layui-btn-xs">详情</a>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                    <!--分页-->
                    <?php echo $list->render() ?>
                </div>
            </form>
        </div>
    </div>
<?php $this->fetch('public/script') ?>

<script>

    $('.outputthis').click(function () {
        var _href = $(this).attr('href');
        layer.confirm('您确定要导出当前查询结果吗？', {
            btn: ['导出','再看看'] //按钮
        }, function(){
            layer.msg('请稍等', {icon: 1});
            location.href = _href;
        }, function(){
            layer.msg('取消导出');
        });
        return false;
    })
    $('.outputall').click(function () {
        var _href = $(this).attr('href');
        layer.confirm('您确定要导出当前查询结果吗？', {
            btn: ['导出','再看看'] //按钮
        }, function(){
            layer.msg('请稍等', {icon: 1});
            location.href = _href;
        }, function(){
            layer.msg('取消导出');
        });
        return false;
    })


</script>


